import { defineStore } from 'pinia';

export const useTestStore = defineStore('test', {
  state: () => ({
    id: 1001,
    familyName: 'zhang',
    name: 'san',
  }),
  getters: {
    getId: (state) => {
      return state.id;
    },
    getFullName: (state) => {
      return state.familyName + '-' + state.name;
    },
  },
  actions: {
    updateName(name: string) {
      this.name = name;
    },
    updateFamilyName(familyName: string) {
      this.familyName = familyName;
    },
  },
});
